package org.com.star.event.service.listener;

import lombok.extern.slf4j.Slf4j;
import org.com.star.event.service.event.UserEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * 定义监听器：
 * 方式二：通过注解来完成对事件的监听
 */
@Slf4j
@Service
public class CouponService {

    @EventListener
    public void sendCoupon(UserEvent userEvent) {
        log.info("发送优惠券给用户：{}", userEvent.getUsername());
    }

}
